package o;

import android.os.Bundle;
import androidx.annotation.Nullable;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

public abstract class bgq extends bgz {
    private int ʽ = 0;
    private AsyLoader ˊ;
    protected String ˋ;
    private List<cvs> ˎ;
    private boolean ˏ = true;
    protected boolean ॱ = false;
    private o.bgq.ResultCallback ॱॱ;

    public static class c implements IServerCallBack {
        public WeakReference<bgq> ˋ;

        public c(bgq o_bgq) {
            this.ˋ = new WeakReference(o_bgq);
        }

        public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
        }

        public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
            bgq o_bgq = (bgq) this.ˋ.get();
            if (o_bgq == null) {
                Logger.e("AbsTaskSegment", "ReqCallback, taskSegment == null");
            } else if (o_bgq.ॱ(o_bgq, new e(o_cvu, responseBean))) {
                o_bgq.ˏ(o_bgq.ʻ() + 1);
                if (o_bgq.ॱॱ().size() > o_bgq.ʻ()) {
                    o_bgq.ˎ(cfw.ˎ((cvs) o_bgq.ॱॱ().get(o_bgq.ʻ()), this));
                }
            } else {
                o_bgq.ˏ(0);
            }
        }
    }

    public interface ResultCallback {
        void ˊ(bgq o_bgq, List<cvs> list);

        boolean ˊ(bgq o_bgq, e eVar);
    }

    public static class e {
        public BaseRequest mReq;
        public ResponseBean mResp;

        public e(BaseRequest o_cvu, ResponseBean responseBean) {
            this.mReq = o_cvu;
            this.mResp = responseBean;
        }
    }

    protected abstract int ˏ();

    public void ॱ(@Nullable Bundle bundle) {
        super.ॱ(bundle);
        if (!this.ॱ) {
            ˋ();
        }
    }

    public void onDestroy() {
        if (ʽ()) {
            ˎ();
        }
    }

    protected void ˋ() {
        ˋ(new ArrayList());
        ॱ(this, ॱॱ());
        if (ॱॱ().size() > ʻ()) {
            cvs o_cvs = (cvs) ॱॱ().get(ʻ());
            o_cvs.setServiceType_(4);
            ˎ(ˋ(o_cvs, new c(this)));
        }
    }

    public void ˎ() {
        if (ᐝ() != null) {
            ᐝ().ˎ(true);
        }
    }

    public boolean ʼ() {
        return this.ॱ;
    }

    public void ˎ(boolean z) {
        this.ॱ = z;
    }

    public void ˋ(o.bgq.ResultCallback dVar) {
        this.ॱॱ = dVar;
    }

    protected AsyLoader ˋ(cvs o_cvs, IServerCallBack iServerCallBack) {
        return cfw.ˊ((cvt) o_cvs, iServerCallBack);
    }

    public void ॱ(bgq o_bgq, List<cvs> list) {
        if (this.ॱॱ != null) {
            this.ॱॱ.ˊ(o_bgq, (List) list);
        }
    }

    public boolean ॱ(bgq o_bgq, e eVar) {
        if (this.ॱॱ != null) {
            return this.ॱॱ.ˊ(o_bgq, eVar);
        }
        return false;
    }

    public boolean ʽ() {
        return this.ˏ;
    }

    public AsyLoader ᐝ() {
        return this.ˊ;
    }

    public void ˎ(AsyLoader o_cwa) {
        this.ˊ = o_cwa;
    }

    public List<cvs> ॱॱ() {
        return this.ˎ;
    }

    public void ˋ(List<cvs> list) {
        this.ˎ = list;
    }

    public int ʻ() {
        return this.ʽ;
    }

    public void ˏ(int i) {
        this.ʽ = i;
    }
}
